import PyWinMouse as mouse
from PyQt5.QtWidgets import QApplication,QWidget,QDialog
from PyQt5.QtCore import QTimer

class c_demo(QWidget):
    def __init__(self,From):
        #1. 简单的绘制一个窗口
        super().__init__(From)
        From.resize(100,150)


        self.mouse = mouse.Mouse()
        self.mouse_listen_timer = QTimer(self)
        self.mouse_listen_timer.timeout.connect(self.print_mouse)
        self.mouse_listen_timer.start(1000)

    def print_mouse(self):
        print(self.mouse.get_mouse_pos())
        # s = event.windowPos()
        # self.setMouseTracking(True)
        # print('X:' + str(s.x()))
        # print('Y:' + str(s.y()))

if __name__ == "__main__":
    import sys
    app = QApplication(sys.argv)
    Dialog_main = QDialog()
    ui = c_demo(Dialog_main)
    Dialog_main.show()
    sys.exit(app.exec_())
